package com.lelouch.examplecode.designpattern.proxy.dynamic.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author lcy
 * @create 2018-10-10 14:12
 */
public class DynamicProxyHandler implements InvocationHandler {

    private Object object;

    public  DynamicProxyHandler(final Object object){
        this.object=object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("代理类之前的处理");
        Object result = method.invoke(object,args);
        System.out.println("代理类之后的处理");
        return result;
    }
}
